/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = ut_frstat_server_init.c                            */
/*  NOTE      =                                                    */
/*  DATE      = 2015/01/30 by guojq                                */
/*******************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <CUnit/Basic.h>
#include <CUnit/CUnit.h>

#include "frcomm.h"
#include "frmem.h"
#include "frlist.h"
#include "frhash2.h"
#include "frame_params.h"
#include "frstat_server.h"
#include "apmtest_cunit.h"

extern int g_i_flag_run;
extern unsigned long g_ul_pcap_queue_used;
extern Frapm_params st_apm_params;

extern int g_i_timeout_stat_srv;


static int __suite_init(void)
{
    g_i_flag_run = 1;
    g_ul_pcap_queue_used = 0L;
    st_apm_params.ui_stat_server_hash_size = 10;
	return 0;
}

static int __suite_cleanup(void)
{
	return 0;
}

static void case1(void)
{
    
    frstat_server_init(2);
    
    CU_ASSERT_EQUAL(g_i_timeout_stat_srv,2);

    frstat_server_destory();
    
    return;

}

int add_suite()
{
	CU_pSuite pSuite = NULL;

	pSuite = CU_add_suite("ut_frstat_server_init 测试", __suite_init, __suite_cleanup);

	if (NULL == pSuite)
	{
		return 1;
	}


    //增加测试用例
   	CU_add_test(pSuite, "case1", case1);

    return 0;

}

int main(int argc, char **argv)
{
    fr_slab_init(52428800, "test");
    run_cunit(add_suite);
    fr_slab_destroy();
    return 0;
}